<?php
/**
 * Created by Yevgen Vershynin.
 * User: Yevgen Vershynin
 * Description: OfficeObject.php
 */
class OfficeObject
{
    public $code = "";
    public $phone = "";
    public $street1 = "";
    public $street2 = "";
    public $city = "";
    public $state = "";
    public $country = "";
    public $postalCode = "";
    public $territory = "";

    public function __construct($dbData)
    {
        //Validate input data and set object properties
        if(isset($dbData['officeCode'])) {
            $this->code = $dbData['officeCode'];
        }
        if(isset($dbData['phone'])) {
            $this->phone = $dbData['phone'];
        }
        if(isset($dbData['addressLine1'])) {
            $this->street1 = $dbData['addressLine1'];
        }
        if(isset($dbData['addressLine2'])) {
            $this->street2 = $dbData['addressLine2'];
        }
        if(isset($dbData['city'])) {
            $this->city = $dbData['city'];
        }
        if(isset($dbData['state'])) {
            $this->state = $dbData['state'];
        }
        if(isset($dbData['country'])) {
            $this->country = $dbData['country'];
        }
        if(isset($dbData['postalCode'])) {
            $this->postalCode = $dbData['postalCode'];
        }
        if(isset($dbData['territory'])) {
            $this->territory = $dbData['territory'];
        }
    }
}
